-
Notifications
You must be signed in to change notification settings - Fork 103
Remove SPIAwareTrait and adopt TestScoping in its place #901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove SPIAwareTrait and adopt TestScoping in its place #901
Conversation
@swift-ci please test |
/// This trait is recursively applied: if it is applied to a suite, any | ||
/// parameterized tests or test suites contained in that suite are also | ||
/// serialized (as are any tests contained in those suites, and so on.) | ||
/// If this trait is applied to a suite, any test functions or test suites |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important to note that parameterized test functions are serialized (as opposed to just function A, function B, function C get serialized.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to tweak the wording more. What I was attempting to clarify with this re-wording is that regular, non-parameterized test functions within a suite which has .serialized
are also serialized alongside any sub-suites which are their peers. I found the existing wording a bit unclear about the handling of non-parameterized test functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recall this being difficult to get right the last time too—might want to ping @iamleeg & friends for assistance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a new phrasing in the mean time
@swift-ci please test |
…ce it wasn't experimental
Sources/Testing/Running/Runner.swift
Outdated
} | ||
} | ||
|
||
if let step = stepGraph.value, case .run = step.action { | ||
await Test.withCurrent(step.test) { | ||
_ = await Issue.withErrorRecording(at: step.test.sourceLocation, configuration: configuration) { | ||
_ = await Issue.withErrorRecording(at: step.test.sourceLocation, configuration: _configuration) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update withErrorRecording
to just pull the current
task-local value? Do we ever use it in a way that needs to take any other value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given where I landed with other changes I don't think I'll need this right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I agree in principle we could make that utility infer the current configuration, just not sure it's needed for this PR
@swift-ci please test |
…ot to avoid decoding error in clients (#1023) This fixes a regression in the encoding of the `Runner.Plan` snapshot types, which can manifest when using Xcode 16. ### Motivation: The `isParallelizationEnabled` property was deprecated and changed from a stored property to a derived one in #901. That caused the value to no longer be encoded in `Runner.Plan.Action.RunOptions`, which can cause decoding errors in versions of Xcode which expect it to still be present. ### Modifications: - Manually implement `Codable` conformance for the affected type to begin including a hardcoded value. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated. Fixes rdar://146284519
This is a follow-on from #733 which introduced the Test Scoping Traits feature. As that proposal indicated, the
SPIAwareTrait
SPI protocol is no longer necessary, so this PR removes it and adoptsTestScoping
in its place.Motivation:
Adopting Test Scoping Traits for the purpose which
SPIAwareTrait
previously served simplifies a lot of runner and planning logic.Modifications:
SPIAwareTrait
and related SPI.TestScoping
inParallelizationTrait
instead.ParallelizationTrait
to not always have the valuetrue
forisRecursive
. Test Scoping Traits makes this no longer necessary: the invocation of children of any suites which have.serialized
is scoped to have parallelization disabled.isParallelizationEnabled
on theRunner.Plan.Action.RunOptions
type. For now, I kept theRunOptions
struct, since it could be useful in the future and it's SPI.Runner
for propagating ancestor steps, and refactored slightly to make many thingsstatic
. This is to help ensure certain functions don't access theself.configuration
property when instead they should be accessingConfiguration.current
.Result:
No functional change, but implementation is simplified.
Checklist: